package com.zegome.game.gomestory.main.scene.play.board;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.zegome.game.entity.sprite.BaseSprite;

public class Clock extends BaseSprite{
	
		Board board;
							
		public Clock(Board board, float pX, float pY) {
			super(pX, pY);
			this.board = board;			
		}
		
		public void setSize(float wi, float hi){
			super.setSize(wi, hi);
			setOrigin(wi/2, hi/2);
		}
				
		float scale=0.0f;
		
		@Override
		public void onDraw(final SpriteBatch pSpriteBatch, final float pAlpha) {
			
			if (!isVisible)
				return;
			
//			 xy: 855, 242
//			  size: 105, 108
//			  orig: 105, 108
			board.screen.ctr.a.clockCore.setRegion(732, (int)(143+108-108*scale), 105, (int)(108*scale));
			
			pSpriteBatch.setColor(mColor.r, mColor.g, mColor.b, mColor.a * pAlpha);
					
			if (mScaleX == 1 && mScaleY == 1 && mRotation == 0){				
				pSpriteBatch.draw(board.screen.ctr.a.clockBound, mX, mY, mWidth, mHeight);	
				pSpriteBatch.draw(board.screen.ctr.a.clockCore, mX, mY, mWidth, (mHeight*scale));									
			}
			else {
				pSpriteBatch.draw(board.screen.ctr.a.clockBound, mX, mY, mOriginX, mOriginY, mWidth, mHeight,
						mScaleX, mScaleY, mRotation);
				pSpriteBatch.draw(board.screen.ctr.a.clockCore, mX, mY, mOriginX, mOriginY, mWidth, mHeight,
					mScaleX, mScaleY, mRotation);
			}
		}
}
